package com.shanzmoo.core.domain.dto;

import com.alibaba.fastjson.JSON;
import com.shanzmoo.db.module.msys.entity.MSysMenuEntity;
import com.shanzmoo.db.module.psys.entity.PSysMenuEntity;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import java.io.Serializable;

/**
 * 系统菜单 保存对象
 *
 * @author： Gzhao 2021/3/29
 */
@Data
@ApiModel("系统菜单-保存对象")
public class SysMenuSaveDTO implements Serializable {

    private static final long serialVersionUID = 1L;

    @ApiModelProperty(value = "父级菜单")
    private Integer parentId;

    @ApiModelProperty(value = "菜单名称")
    private String title;

    @ApiModelProperty(value = "图标")
    private String icon;

    @ApiModelProperty(value = "路由地址")
    private String component;

    @ApiModelProperty(value = "路由名称")
    private String routerName;

    @ApiModelProperty(value = "组件路径")
    private String path;

    @ApiModelProperty(value = "是否隐藏菜单：false-显示，true-隐藏")
    private Boolean hidden;

    @ApiModelProperty(value = "页面是否要缓存：false-否，true-是")
    private Boolean cache;

    @ApiModelProperty(value = "权限标识")
    private String perms;

    @ApiModelProperty(value = "排序号")
    private Integer index;

    public MSysMenuEntity convertM() {
        return JSON.parseObject(JSON.toJSONString(this), MSysMenuEntity.class);
    }

    public PSysMenuEntity convertP() {
        return JSON.parseObject(JSON.toJSONString(this), PSysMenuEntity.class);
    }
}
